﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Plugin.Core;
using Plugin.Configs;
using System.Windows.Forms;

namespace TestPlugin
{
    [Slot("Workbench")]
    [PluginInfo("Workbench","none","Syamand Mahrofy","Armani Software Ltd.","2009/08/24","1.0.0.0")]
    [PluginSettings(Run=true,IsControl=false)]
    public class Workbench:IPlugin
    {
        private XMLConfig MainConfig=new XMLConfig();

        private IPlugins _Plugins=new IPlugins();
        
        public IConfigoration Config
        {
            get;
            set;
        }

        public IPlugin Parent
        {
            get;
            set;
        }

        public IPlugins Plugins
        {
            get {return _Plugins; }
        }

        public void Run(params object[] parameters)
        {
            MasterForm masterForm = new MasterForm();
            foreach (IPlugin plg in Plugins)
            {
                PluginSettingsAttribute setting = PluginSettingsAttribute.FromPlugin(plg);
                if ((setting.IsControl) && (plg.Value is Control))
                {
                    masterForm.Controls.Add(plg.Value as Control);
                }
            }
            Application.Run(masterForm);
        }

        public object Value
        {
            get;
            set;
        }

    }
}
